#pragma once
#define COLOR_BLACK		0
#define COLOR_DARK_BLUE 1
#define COLOR_DARK_GREEN 2
#define COLOR_DARK_CYAN 3
#define COLOR_DARK_RED	4
#define COLOR_DARK_MAGENTA 5
#define COLOR_DARK_YELLOW 6
#define COLOR_GRAY		7
#define COLOR_DARK_GRAY 8
#define COLOR_BLUE		9
#define COLOR_GREEN		10
#define COLOR_CYAN		11
#define COLOR_RED		12
#define COLOR_MAGENTA	13
#define COLOR_YELLOW	14
#define COLOR_WHITE		15

//the dimensions of the board (I may add a feature that allows the player to adjust the size of
//the board later.  For now I will stick with these
#define BOARD_HEIGHT	6
#define	BOARD_WIDTH		7

//player indicators so that the game knows whose turn it is
#define PLAYER_ONE		1
#define PLAYER_TWO		2

//determines whether the game is played with one or two players
//these will be typecasted as "chars" as the player presses '1' or '2'
#define ONE_PLAYER	49
#define	TWO_PLAYERS	50

//piece positions
#define STARTING_POSITION	3
#define START_DROP	-1
#define ZERO	0

//diagonal counting references (offsets from top corners)
#define STARTING_HORIZONTAL_OFFSET	1
#define STARTING_VERTICAL_OFFSET	2
#define ENDING_HORIZONTAL_OFFSET	3

// the amount of pieces a player has to line up in a row to be declared the winner
#define WINNER	4

#include "gamepiece.h"
#include "player.h"

//added by Roberto
//#include <iostream>
//#include <string>
//#include <conio.h>
#include "keeptrack.h"
//using namespace std;

//added by Earsell
#include "ai.h"

class Gameboard
{
private:
	char piecePositionArray[BOARD_WIDTH];
	char m_board[BOARD_HEIGHT][BOARD_WIDTH];
	int m_colorMap[BOARD_HEIGHT][BOARD_WIDTH];
	int m_player;
	int m_width, m_height;// added by Adam
	char m_input;
	char m_gameInput;
	char **m_Map;// added by Adam
	Gamepiece piece;
	Player p1;
	Player p2;
	Ai cpu;//added by Earsell

	//added by Roberto
	KeepTrack start;
	int m_somescore1,m_somescore2;

public:
	string m_somename1,m_somename2;
	Gameboard();
	void setPlayerNumber(int a_player);
	int getPlayerNumber();

	void setInput(char a_input);
	char getInput();

	void setGameInput(char a_gameInput);
	char getGameInput();
	//	---		Output functions	---  //
	void drawTitleScreen();
	void clearBoard();
	void drawBoard();
	void initializeColorMap();//slight logic in this function
	void drawGraphics();//slight logic in this function

	//	---		Input functions		---	//
	void startGame();
	void handleInput(char input);

	//	---		Main Loop			---	//
	void gameLoop();

	//	---		Logic functions		---	//
	void shiftPieceLeft();
	void shiftPieceRight();
	void dropPiece();
	void drawPiece();
	void gameWin();
	void checkWinStatus();
	bool gameFinished();
	int endGame();
	
};